﻿@model RewardPointsSettingsModel

@using Nop.Core.Domain.Customers
@using Nop.Core.Domain.Orders
@using Nop.Services

@{
    //page title
    ViewBag.Title = T("Admin.Configuration.Settings.RewardPoints").Text;
    //active menu item (system name)
    Html.SetActiveMenuItemSystemName("Reward points");
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="content-header clearfix">
        <h1 class="pull-left">
            @T("Admin.Configuration.Settings.RewardPoints")
        </h1>
        <div class="pull-right">
            <button type="submit" name="save" class="btn bg-blue">
                <i class="fa fa-floppy-o"></i>
                @T("Admin.Common.Save")
            </button>
        </div>
    </div>

    <div class="content">
        <div class="form-horizontal">
            @Html.Action("StoreScopeConfiguration", "Setting")
            @Html.Action("Mode", "Setting")
            @Html.ValidationSummary(false)

            <div class="panel-group">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        @T("Admin.Configuration.Settings.RewardPoints.BlockTitle.Common")
                    </div>
                    <div class="panel-body">
                        <p>
                            @T("Admin.Configuration.Settings.RewardPoints.Description")
                        </p>
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.Enabled_OverrideForStore, model => model.Enabled, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.Enabled)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.Enabled)
                                @Html.ValidationMessageFor(model => model.Enabled)
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.ExchangeRate_OverrideForStore, model => model.ExchangeRate, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.ExchangeRate)
                            </div>
                            <div class="col-md-9">
                                <div class="form-text-row pull-left margin-r-10">@T("Admin.Configuration.Settings.RewardPoints.ExchangeRate.Hint2")</div>
                                <div class="pull-left">
                                    @Html.NopEditorFor(model => model.ExchangeRate, Model.PrimaryStoreCurrencyCode)
                                    @Html.ValidationMessageFor(model => model.ExchangeRate)
                                </div>
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.MinimumRewardPointsToUse_OverrideForStore, model => model.MinimumRewardPointsToUse, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.MinimumRewardPointsToUse)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.MinimumRewardPointsToUse)
                                @Html.ValidationMessageFor(model => model.MinimumRewardPointsToUse)
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        @T("Admin.Configuration.Settings.RewardPoints.Earning")
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.PointsForPurchases_OverrideForStore, model => model.PointsForPurchases_Amount, model => model.PointsForPurchases_Points, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.PointsForPurchases_Amount)
                            </div>
                            <div class="col-md-9">
                                <div class="form-text-row pull-left margin-r-10">@T("Admin.Configuration.Settings.RewardPoints.Earning.Hint1")</div>
                                <div class="pull-left margin-r-10">@Html.NopEditorFor(model => model.PointsForPurchases_Amount, Model.PrimaryStoreCurrencyCode)</div>
                                <div class="form-text-row pull-left margin-r-10">@T("Admin.Configuration.Settings.RewardPoints.Earning.Hint2")</div>
                                <div class="pull-left margin-r-10">@Html.NopEditorFor(model => model.PointsForPurchases_Points)</div>
                                <div class="form-text-row pull-left margin-r-10">@T("Admin.Configuration.Settings.RewardPoints.Earning.Hint3")</div>
                                @Html.ValidationMessageFor(model => model.PointsForPurchases_Amount)
                                @Html.ValidationMessageFor(model => model.PointsForPurchases_Points)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.PointsForRegistration_OverrideForStore, model => model.PointsForRegistration, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.PointsForRegistration)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.PointsForRegistration)
                                @Html.ValidationMessageFor(model => model.PointsForRegistration)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.NopLabelFor(model => model.ActivatePointsImmediately)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.ActivatePointsImmediately)
                                @Html.ValidationMessageFor(model => model.ActivatePointsImmediately)
                            </div>
                        </div>
                        <div class="form-group advanced-setting" id="pnl-activating-delay">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.ActivationDelay_OverrideForStore, model => model.ActivationDelay, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.ActivationDelay)
                            </div>
                            <div class="col-md-9">
                                <div class="row">
                                    <div class="col-md-3">
                                        @Html.NopEditorFor(model => model.ActivationDelay)
                                        @Html.ValidationMessageFor(model => model.ActivationDelay)
                                    </div>
                                    <div class="col-md-3">
                                        @Html.NopDropDownListFor(model => model.ActivationDelayPeriodId, ((RewardPointsActivatingDelayPeriod)Model.ActivationDelayPeriodId).ToSelectList(), htmlAttributes: new { style = "max-width: 200px;" })
                                        @Html.ValidationMessageFor(model => model.ActivationDelayPeriodId)
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.DisplayHowMuchWillBeEarned_OverrideForStore, model => model.DisplayHowMuchWillBeEarned, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.DisplayHowMuchWillBeEarned)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.DisplayHowMuchWillBeEarned)
                                @Html.ValidationMessageFor(model => model.DisplayHowMuchWillBeEarned)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.NopLabelFor(model => model.PointsAccumulatedForAllStores)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.PointsAccumulatedForAllStores)
                                @Html.ValidationMessageFor(model => model.PointsAccumulatedForAllStores)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideStoreCheckboxFor(model => model.PageSize_OverrideForStore, model => model.PageSize, Model.ActiveStoreScopeConfiguration)
                                @Html.NopLabelFor(model => model.PageSize)
                            </div>
                            <div class="col-md-9">
                                @Html.NopEditorFor(model => model.PageSize)
                                @Html.ValidationMessageFor(model => model.PageSize)
                            </div>
                        </div>
                    </div>

                    <script type="text/javascript">
                        $(document).ready(function () {
                            $("#@Html.FieldIdFor(model => model.ActivatePointsImmediately)").click(activatePointsImmediately);
                            activatePointsImmediately();
                        });

                        function activatePointsImmediately() {
                            if ($('#@Html.FieldIdFor(model => model.ActivatePointsImmediately)').is(':checked'))
                                $('#pnl-activating-delay').hide();
                            else
                                $('#pnl-activating-delay').show();
                        }
                    </script>

                </div>
            </div>
        </div>
    </div>
}
